package com.example.mqtt.client;

import io.netty.buffer.ByteBuf;
import io.netty.handler.codec.mqtt.MqttQoS;

import java.util.concurrent.CompletableFuture;

public interface IMqttClient {

    /**
     * connect to mqtt broker
     */
    void connect();

    /**
     * close mqtt client
     */
    void close();

    void close2();

    /**
     * publish message to mqtt broker
     * @param topic topic
     * @param payload payload
     * @param qos qos
     * @param retain retain
     * @return
     */
    CompletableFuture<Void> publish(String topic, ByteBuf payload, MqttQoS qos, boolean retain);


    CompletableFuture<Void> subscribe(String topic);

    CompletableFuture<Void> unSubscribe(String topic, MqttQoS qos);
}
